home *** CD-ROM | disk | FTP | other *** search
/ Isometric Game Programming with DirectX 7.0 / Isometric Game Programming.iso / directx / dxf / samples / multimedia / directshow / baseclasses / fourcc.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-10-02  |  2.0 KB  |  102 lines

  1. //------------------------------------------------------------------------------
  2. // File: FourCC.h
  3. //
  4. // Desc: DirectShow base classes.
  5. //
  6. // Copyright (c) 1992 - 2000, Microsoft Corporation.  All rights reserved.
  7. //------------------------------------------------------------------------------
  8.  
  9.  
  10. // FOURCCMap
  11. //
  12. // provides a mapping between old-style multimedia format DWORDs
  13. // and new-style GUIDs.
  14. //
  15. // A range of 4 billion GUIDs has been allocated to ensure that this
  16. // mapping can be done straightforwardly one-to-one in both directions.
  17. //
  18. // January 95
  19.  
  20.  
  21. #ifndef __FOURCC__
  22. #define __FOURCC__
  23.  
  24.  
  25. // Multimedia format types are marked with DWORDs built from four 8-bit
  26. // chars and known as FOURCCs. New multimedia AM_MEDIA_TYPE definitions include
  27. // a subtype GUID. In order to simplify the mapping, GUIDs in the range:
  28. //    XXXXXXXX-0000-0010-8000-00AA00389B71
  29. // are reserved for FOURCCs.
  30.  
  31. class FOURCCMap : public GUID
  32. {
  33.  
  34. public:
  35.     FOURCCMap();
  36.     FOURCCMap(DWORD Fourcc);
  37.     FOURCCMap(const GUID *);
  38.  
  39.  
  40.     DWORD GetFOURCC(void);
  41.     void SetFOURCC(DWORD fourcc);
  42.     void SetFOURCC(const GUID *);
  43.  
  44. private:
  45.     void InitGUID();
  46. };
  47.  
  48. #define GUID_Data2      0
  49. #define GUID_Data3     0x10
  50. #define GUID_Data4_1   0xaa000080
  51. #define GUID_Data4_2   0x719b3800
  52.  
  53. inline void
  54. FOURCCMap::InitGUID() {
  55.     Data2 = GUID_Data2;
  56.     Data3 = GUID_Data3;
  57.     ((DWORD *)Data4)[0] = GUID_Data4_1;
  58.     ((DWORD *)Data4)[1] = GUID_Data4_2;
  59. }
  60.  
  61. inline
  62. FOURCCMap::FOURCCMap() {
  63.     InitGUID();
  64.     SetFOURCC( DWORD(0));
  65. }
  66.  
  67. inline
  68. FOURCCMap::FOURCCMap(DWORD fourcc)
  69. {
  70.     InitGUID();
  71.     SetFOURCC(fourcc);
  72. }
  73.  
  74. inline
  75. FOURCCMap::FOURCCMap(const GUID * pGuid)
  76. {
  77.     InitGUID();
  78.     SetFOURCC(pGuid);
  79. }
  80.  
  81. inline void
  82. FOURCCMap::SetFOURCC(const GUID * pGuid)
  83. {
  84.     FOURCCMap * p = (FOURCCMap*) pGuid;
  85.     SetFOURCC(p->GetFOURCC());
  86. }
  87.  
  88. inline void
  89. FOURCCMap::SetFOURCC(DWORD fourcc)
  90. {
  91.     Data1 = fourcc;
  92. }
  93.  
  94. inline DWORD
  95. FOURCCMap::GetFOURCC(void)
  96. {
  97.     return Data1;
  98. }
  99.  
  100. #endif /* __FOURCC__ */
  101.  
  102.